<template>
	<view class="list-main"  @click.stop="goLineInfo(lineInfo.lineId)">
	    <view class="display-flex-column">
			<view class="line-sn">
				{{lineInfo.lineSn}}
			</view>
			<view class="row" style="margin-bottom: 15px;">
				<view class="display-flex-column">
					<view class="row-center">
						<view class="station_dot station_dot_start">
						</view>
						<view class="od-item">
							{{lineInfo.origin}}
						</view>
					</view>
					
					<view class="shu-line" style="margin: 0 20px;">
						
					</view>
					
					<view class="row-center">
						<view class="station_dot station_dot_end">
						</view>
						<view class="od-item">
							{{lineInfo.destination}}
						</view>
					</view>
					<view v-if="lineInfo.companyName" class="row-center" style="color: #c8c8c8;font-size: 12px; margin: 8px 15px 0 15px;">
					    <text class="iconfont icon-qichebanci" style="margin-right: 5px;font-size: 16px;" ></text>
						<view class="">
						     {{lineInfo.companyName}}
						</view>
					</view>
				</view>
				<view class="ticket-item text_align_center">
					<view class="buy-ticket-button line-ellipsis">
						选择线路
					</view>
				</view>
			</view>

		</view>
	</view>
	
</template>

<script>
	import { selectLine} from '@/api/api.js'
	
	export default {
		
		props:{
			lineInfo: {
				type: Object,
				default: () => {}
			}
		},
		data() {
			return {};
		},
		mounted(){
		},
		methods: {
			
			goLineInfo:function(line_id){
				var that = this
				uni.showModal({
					title: '温馨提示',
					content: '请确认选择此线路，您将持续为本线路提供实时定位！',
					success(res) {
						if (res.confirm) {
							selectLine({
								lineId: line_id
							}).then(res =>{
								var lineDriverId = res.data
								uni.navigateTo({
									url:'/pages/driver_map/index?lineId='+line_id+'&lineDriverId='+lineDriverId
								})
							}).catch(err => {
								console.log(33,err)
								that.$u.toast(err)
							})
						}
					}
				});
				
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f7f7f7 !important;
	}
	.list-main{
		position: relative;
		margin: 12rpx 24rpx;
		background-color: #fff;
		border-radius: 4px;
	}
	
	.line-sn {
		font-size: 15px;
		font-weight: 600;
		color: #000000;
		margin: 8px 10px;
	}
	.od-item{
		color: #888;
		font-size: 12px;
	}
	
	.ticket-item {
		margin-left: auto;
		margin-right: 20px;
	}
</style>